package vip.xls8z.lfi.filter;

import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.context.annotation.DependsOn;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import javax.servlet.*;
import java.io.IOException;

@Order(2)
@Component
public class OthersFilter implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        Filter.super.init(filterConfig);
        System.out.println("OthersFilter initialized.");
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.out.println("OthersFilter before.");
        filterChain.doFilter(servletRequest, servletResponse);
        System.out.println("OthersFilter after.");
    }

    @Override
    public void destroy() {
        Filter.super.destroy();
        System.out.println("OthersFilter destroy.");
    }
}

